home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Hyper
/
Hyperj-Hz
/
HyperTalk trick.cpt
/
HyperTalk trick
/
card_2874.txt
< prev
next >
Wrap
Text File
|
1990-12-13
|
1KB
|
50 lines
-- card: 2874 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 2770
-- name:
----- HyperTalk script -----
function q
-- utility function to evaluate and quote arguments
-- Example: q(a,1+1,...,z) -> "a","2",...,"z"
-- Author: Mark G. Mendel, GENIE: MGM, uucp: umn-cs.MN.ORG!hyper!mark
put quote & param(1) & quote into res
repeat with i = 2 to the paramCount
put "," & quote & param(i) & quote after res
end repeat
return res
end q
-- part 1 (field)
-- low flags: 00
-- high flags: 4007
-- rect: left=5 top=25 right=287 bottom=510
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part contents for card part 1
----- text -----
This card's script contains the very short but very useful function Q().
Q() takes a variable number of arguments and returns a string containing the arguments values quoted and separated by commas.
Q() is particularly usefull with the "Send" and "Do" commands.
Using it allows one to transform expressions like:
do "boo " & quote & 2+2 & quote & "," & quote & the Date & quote
into
do "boo " & q(2+2,the Date)